package com.example.socket;

import java.nio.charset.Charset;

import org.apache.mina.core.service.IoAcceptor;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.mina.filter.codec.textline.TextLineCodecFactory;
import org.apache.mina.filter.logging.LoggingFilter;
import org.apache.mina.transport.socket.nio.NioSocketAcceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MinaConfiguration {
 public @Bean IoAcceptor ioAcceptor(){
	 return new NioSocketAcceptor();
 }
 public @Bean LoggingFilter loggingFiler(){
	 return new LoggingFilter();
 }
 public @Bean ProtocolCodecFilter protocolCodecFilter(){
	 return  new ProtocolCodecFilter(new TextLineCodecFactory(Charset.forName("UTF-8")));
 }
}
